package org.testframe;

/**
 * 时间等待器
 * @author 丁常磊
 * @date 2023/11/17 13:12
 */

public class TimeWaite {

    private Long start;

    private final Long maxWaite;

    public TimeWaite(Long maxWaite) {
        this.maxWaite = maxWaite;
    }

    public boolean isEnd() {
        if (start == null) {
            start = System.currentTimeMillis();
        }
        return System.currentTimeMillis() - start >= maxWaite;
    }

    @Override
    public String toString() {
        return maxWaite + "ms";
    }
}
